package top.jiangqiang.qyblog.admin.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import top.jiangqiang.qyblog.common.base.controller.BaseController;
import top.jiangqiang.qyblog.common.base.response.Result;
import top.jiangqiang.qyblog.common.constant.RequestURLConstants;
import top.jiangqiang.qyblog.core.domain.dto.BlogConfigDto;
import top.jiangqiang.qyblog.core.domain.vo.BlogConfigVo;
import top.jiangqiang.qyblog.core.service.IConfigService;

/**
 * @author jiangqiang
 * @date 2022-12-03
 */
@RequiredArgsConstructor
@RestController
@RequestMapping(RequestURLConstants.CONFIG_CONTROLLER_PREFIX)
@Tag(name = "系统配置接口")
public class ConfigController extends BaseController {
    private final IConfigService configService;

    @GetMapping("/blog")
    @Operation(summary = "查询博客配置", description = "获取博客配置")
    public Result<BlogConfigVo> getBlogConfig() {
        return configService.getBlogConfig();
    }

    @PutMapping("/blog")
    @Operation(summary = "修改博客配置", description = "根据条件查询配置列表")
    public Result<String> updateBlog(@RequestBody BlogConfigDto blogConfigDto) {
        return configService.updateBlogConfig(blogConfigDto);
    }

}
